package com.kaluli.project.service;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class CommonService {

	

	public String addTime(int days){
		String now =null;
		int n=days;//需要加上的天数
		SimpleDateFormat sDateFormat= new SimpleDateFormat("yyyy-MM-dd");  
		SimpleDateFormat sdf = new SimpleDateFormat("MM");
		java.util.Calendar calstart = java.util.Calendar.getInstance();
		      calstart.add(java.util.Calendar.DAY_OF_WEEK, n); 
		      String str = sDateFormat.format(calstart.getTime()).substring(5,7);
		      Date date = null;
		      try {
					date = sdf.parse(str);
				} catch (ParseException e) {
					// TODO 自动生成的 catch 块
					e.printStackTrace();
				}
		      sdf = new SimpleDateFormat("MMMMM",Locale.US);
		String time1=sDateFormat.format(calstart.getTime());
		now = sdf.format(date)+" "+time1.substring(8,10)+", "+time1.substring(0,4);
		return now;
	}
	
}
